<template>
  <record-link v-model="contractNo"
               :link="router"
               :tag="tag"
               :row="row"
               copyable
               v-bind="$attrs">
    <el-tooltip v-if="isTooltip"
                class="mr10"
                effect="dark"
                content="货物异常"
                placement="top">
      <icon-svg class-name="iconClass"
                icon-name="yichang" />
    </el-tooltip>
  </record-link>
</template>

<script>
import RecordLink from '@basic/RecordLink.vue'

export default {
  name: "ContractLink",
  components: {
    RecordLink
  },
  inheritAttrs: true,
  props: {
    contractNo: String,
    router: String,
    row: {
      type: Object,
      default: () => { }
    },
    // 拆单标识
    orderType: {
      type: Number,
      default: 0
    },
    // 合单标识
    combine: {
      type: Number,
      default: 0
    },
    // 货物异常标识
    exception: {
      type: Number,
      default: 0
    },
  },
  computed: {
    isTooltip () {
      return this.exception && this.row?.goodsException
    },
    tag () {
      let tag;
      if (this.orderType === 1 && this.row.divide) return tag = "拆";
      if (this.combine === 1 && this.row.combineContractNo) return tag = "合单";
      return tag
    }
  }
}
</script>